import { Component, OnInit, Input } from '@angular/core';
import { PopoverController } from '@ionic/angular';
import { OperationsPopoverComponent } from '../operations-popover/operations-popover.component';

@Component({
  selector: 'app-head-toolbar',
  templateUrl: './head-toolbar.component.html',
  styleUrls: ['./head-toolbar.component.scss'],
})
export class HeadToolbarComponent implements OnInit {

  @Input('return-url')
  returnUrl:string;

  constructor(private popoverController: PopoverController) { }

  ngOnInit() { }

  async moreClick(event: any) {
    const popover = await this.popoverController.create({
      component: OperationsPopoverComponent,
      componentProps: {
        returnUrl: this.returnUrl
      },
      event: event,
      showBackdrop: false
    });
    await popover.present();
  }
}
